﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Sockets;
using System.Net;

namespace SQLProxy
{
    class Listener
    {
        public TcpListener createListener() {
            // read initialization data
            Console.Write("Type the proxy port: ");
            int port = int.Parse(Console.ReadLine());
            Console.Write("Type the number of the database (1 or 2): ");
            DatabaseConnector.Database = int.Parse(Console.ReadLine());

            // initiate tcp listener on designated port
            TcpListener l = new TcpListener(port);
            l.Start();
            Console.WriteLine("Waiting for clients to connect");
            Console.WriteLine("Press Ctrl+C to quit...");
            return l;
        }
    }
}
